Extensible Markup Language (XML) is widely used in the fields of network services, databases, and file processing. The XML has the following characteristics: the content and the structure of the document being completely separated; strong interoperability; unified standard; supporting a variety of coding; and good expandability.
Since the XML file may include a multi-level nested data structure, the XML parsing is usually complex. In multi-core processor environment, the use of a multi-core structure-based design for XML parallel parsing can improve parsing speed of the XML parsing. Presently, in the commonly used XML parallel parsing method, it is required to partition an XML file into multiple data chunks with the same size, and then parse the multiple data chunks in parallel by multiple cores of a multi-core processor.
However, after research, the inventor has found that in the prior art, if the XML file is partitioned into multiple data chunks with the same size, the content of one XML element may be distributed into two different chunks, and the parsing program can only parse this data in a speculating manner. Furthermore, in parallel-parsing multiple data chunks, it is required to check the data-dependent relationship between the data chunks, which will lead to frequent communications between the threads of the parallel parsing. When the thread is waiting for a communication response, the running is suspended or the processing speed slows down, thus affecting the efficiency of parallel processing.